var ctx;
var billId;
var payWay ;
var beginTime ;
var endTime;

function setCtx(ctx){
	this.ctx = ctx;
}


//判断是否为空
function ifNull(mess){
	if(mess == null || mess == undefined){
		mess = "";
	}
	
	return mess;
}

function checkDate () {
	beginDate = $("#beginTime").val();
	endDate = $("#endTime").val();
	//解决ie9以下placeholder与value重复的问题
	if(beginDate == $("#beginDate").attr("placeholder")){
		beginDate = "";
	}
	if(endDate == $("#endDate").attr("placeholder")){
		endDate = "";
	}
    var start=new Date(beginDate.replace("-", "/").replace("-", "/"));  
    var end = new Date(endDate.replace("-", "/").replace("-", "/"));  
    if(end < start){
    	layer.msg("结束时间应大于起始时间",{
			icon: 3,
			time: 1000 //2秒关闭（如果不配置，默认是3秒）
		});
    	return false;
    }
    return true;
}

//条件搜索用户列表
function getDetailList(){
	payWay = 0;
	billId = ifNull($("#billId").val());
	beginTime = ifNull($("#beginTime").val());
	endTime = ifNull($("#endTime").val());
	pSize = ifNull($("#pSize").val());
	//解决ie9以下placeholder与value重复的问题
	if(billId == $("#billId").attr("placeholder")){
		billId = "";
	}
	if (checkDate()) {
		loadContent("/feeBillDetail/delList?pNo=1&payWay="+ payWay+ "&billId="+ 
				billId+ "&beginTime="+ beginTime+ "&endTime="+ endTime + "&pSize="+ pSize);
	}
}

//跳转到指定页面
function gotoBillPage(page) {
	if(page == null){
		page = $(".inputclass").val();
	}
	
	payWay = 0;
	billId = ifNull($("#billId").val());
	beginTime = ifNull($("#beginTime").val());
	endTime = ifNull($("#endTime").val());
	pSize = ifNull($("#pSize").val());
	
	//解决ie9以下placeholder与value重复的问题
	if(billId == $("#billId").attr("placeholder")){
		billId = "";
	}
	loadContent("/feeBillDetail/delList?pNo="+page+ "&payWay="+ payWay+ "&billId="+ 
			billId+ "&beginTime="+ beginTime+ "&endTime="+ endTime + "&pSize="+ pSize);
}

//跳转到上一页或者下一页
function gotoPage(page){
	payWay = 0;
	billId = ifNull($("#billId").val());
	beginTime = ifNull($("#beginTime").val());
	endTime = ifNull($("#endTime").val());
	pSize = ifNull($("#pSize").val());
	
	//解决ie9以下placeholder与value重复的问题
	if(billId == $("#billId").attr("placeholder")){
		billId = "";
	}
	if (checkDate()) {
		loadContent("/feeBillDetail/delList?pNo="+page+ "&payWay="+ payWay+ "&billId="+ 
				billId+ "&beginTime="+ beginTime+ "&endTime="+ endTime + "&pSize="+ pSize);
	}
}


//鼠标滑入一行改变背景颜色
function mouseoverOne(target){
	 $(target).children().each(function(){
		  	    $(this).css("background","#D3F0F1");
		     });
}

//鼠标滑出一行恢复原来的背景颜色
function mouseoutOne(target){
	 $(target).children().each(function(){
	  	    $(this).css("background","");
	     });
}

//实现字段较长时的隐藏于显示
function mouseOverInfo(item , answer){
	layer.tips(answer, '#answer' + item, {
		  tips: [3, '#2F2F2F'],
		  time: 5000
		});
}

//查看缴费信息详情
function gotoDetail (id,houseId) {
	loadContent("/feeBillDetail/gotoDetail?id="+id+"&houseId="+houseId+"&type=3");
}
